package so.sao.code.service.infrastructure.enums;

import so.sao.top.core.util.enums.NamedEnumEntity;

public enum PrintFileFieldConfig implements NamedEnumEntity<String> {
    CODEURL("code_url", "二维码url"), FRIENDLYCODE("friendly_code", "完整字符串"), FRIENDLYCODEFRONT("friendly_code_front",
            "前半字符串"), FRIENDLYCODEEND("friendly_code_end", "后半字符串"), SEQNUM("seqnum", "完整序号"), SEQNUMFRONT(
            "seqnum_front",
            "前半序号"), SEQNUMEND("seqnum_end", "后半序号"), PACKAGECODEURL("package_code_url", "包装码url"),
    BOXCODEURL("box_url", "盒码url"),
    BOXCODEURLSEQ("box_url_seq", "盒码url带序号");

    private String id;
    private String name;

	private PrintFileFieldConfig(String id, String name) {
		this.id = id;
        this.name = name;
    }

    @Override
    public String getValue() {
        return id;
    }

    @Override
    public String getName() {
        return name;
    }

	public static PrintFileFieldConfig fromValue(String id) {
		switch (id) {
		case "code_url":
			return CODEURL;
		case "friendly_code":
			return FRIENDLYCODE;
		case "friendly_code_front":
			return FRIENDLYCODEFRONT;
		case "friendly_code_end":
			return FRIENDLYCODEEND;
		case "seqnum":
			return SEQNUM;
		case "seqnum_front":
			return SEQNUMFRONT;
		case "seqnum_end":
			return SEQNUMEND;
		case "package_code_url":
			return PACKAGECODEURL;
		case "box_url":
			return BOXCODEURL;
		case "box_url_seq":
			return BOXCODEURLSEQ;
		default:
			throw new IllegalArgumentException("Value [" + id + "] not support!");
		}
	}
}
